package org.datascooter.impl;

import java.sql.SQLException;

import org.datascooter.utils.policy.SnipType;

/**
 * It is a main agent for working with database - it receives snips and return snips all other work with database take place incide
 * 
 * @author nemo
 * 
 */
class SnipExecutor extends SimpleExecutor {

	public SnipExecutor(boolean supportPagination, boolean callParameterMetadata) {
		super(supportPagination, callParameterMetadata);
	}

	@Override
	public void execute(Snip snip) throws SQLException {
		if (snip.type.equals(SnipType.SELECT) || snip.type.equals(SnipType.GROUP)) {
			retrieve(null, snip);
		} else if (snip.type.equals(SnipType.FUNCTION)) {
			executeCount(snip);
		} else {
			executeSimple(null, snip);
		}
	}
}
